package com.example.appusagestats.model

import android.graphics.drawable.Drawable

data class AppUsageInfo(
    val packageName: String,
    val appName: String,
    val appIcon: Drawable?,
    val totalTimeInForeground: Long,
    val usageEvents: List<UsageEvent> = emptyList()
) {
    fun getFormattedUsageTime(): String {
        val hours = totalTimeInForeground / (1000 * 60 * 60)
        val minutes = (totalTimeInForeground % (1000 * 60 * 60)) / (1000 * 60)
        val seconds = (totalTimeInForeground % (1000 * 60)) / 1000

        return when {
            hours > 0 -> "${hours}小时${minutes}分钟"
            minutes > 0 -> "${minutes}分钟${seconds}秒"
            else -> "${seconds}秒"
        }
    }
} 